import React, { ReactElement, memo } from "react";

export interface ILayoutDto {
  num: number;
}

export interface LayoutDto {
  layoutData: ILayoutDto;
  setLayoutData?: (fn: (v: ILayoutDto) => ILayoutDto) => void;
}
const LayoutContext = React.createContext<LayoutDto | null>(null);

export default LayoutContext;

export const LayoutProvider = memo(function LayoutProvider(props: {
  value: LayoutDto | null;
  children: ReactElement | ReactElement[];
}) {
  return (
    <LayoutContext.Provider value={props.value}>
      {props?.children}
    </LayoutContext.Provider>
  );
});
